package org.example.mapper;

import org.apache.ibatis.annotations.*;
import org.example.entit.User;
import org.example.mode.RegisterUser;

@Mapper
public interface UserMapper {

    @Insert("insert into users (username, password, role, phone)" +
            "values(#{username}, #{password}, #{role}, #{phone})")
    Integer registerUser(RegisterUser registerUser);

    @Select("select * from users where username = #{username}")
    RegisterUser getUserInfoByUserName(String username);

    @Delete("delete from users where username =  #{username}")
    Integer deleteuserByUsername(String username);

    @Update("update users set password = #{password}, role = #{role}, phone = #{phone}  where username = #{username}")
    Integer updateUserInfoUername(RegisterUser registerUser);
}


